<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui/lib/layui-v2.5.5/css/layui.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui/css/public.css" media="all">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui_ext/dtree/dtree.css"><link rel="stylesheet" href="${pageContext.request.contextPath}/statics/layui_ext/dtree/font/dtreefont.css">
</head>
<body>
<div class="layuimini-container">
    <div class="layuimini-main">
        <%-- 搜索条件区域 --%>
        <fieldset class="table-search-fieldset">
            <legend>搜索信息</legend>
            <div style="margin: 10px 10px 10px 10px">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">访问人</label>
                            <div class="layui-input-inline">
                                <input type="text" name="userName" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">开始日期</label>
                            <div class="layui-input-inline">
                                <input type="text" name="startDate" id="startTime" autocomplete="off" class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">结束日期</label>
                            <div class="layui-input-inline">
                                <input type="text" name="endDate" id="endTime" autocomplete="off" class="layui-input" readonly>
                            </div>
                        </div>
                        <div class="layui-inline">
                            <button type="submit" class="layui-btn"  lay-submit lay-filter="data-search-btn"><i class="layui-icon layui-icon-search"></i>搜索</button>
                            <button type="reset" class="layui-btn layui-btn-warm"><i class="layui-icon layui-icon-refresh-1"></i>重置</button>
                        </div>
                    </div>
                </form>
            </div>
        </fieldset>

        <%-- 表格工具栏 --%>
        <script type="text/html" id="toolbarDemo">
            <p class="layui-btn layui-btn-danger layui-btn-sm">
                <i class="layui-icon layui-icon-about"></i>默认保存最近3天的记录！</p>
        </script>

        <%-- 表格区域 --%>
        <table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table>
    </div>
</div>
<div id="selectRoleMenuDiv" style="display: none;padding: 5px">
    <ul id="roleTree" class="dtree" data-id="0"></ul>
</div>
<script src="${pageContext.request.contextPath}/statics/layui/lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
<script>
    layui.extend({
        dtree:"${pageContext.request.contextPath}/statics/layui_ext/dtree/dtree"
    }).use(['form', 'table','laydate'], function () {
        var $ = layui.jquery,
            form = layui.form,
            laydate = layui.laydate,
            table = layui.table;
        //渲染日期组件
        laydate.render({
            elem: '#startTime', //指定元素
            type: 'date'
        });
        laydate.render({
            elem: '#endTime',
            type: 'date'
        });
        var tableIns = table.render({
            elem: '#currentTableId',
            toolbar: '#toolbarDemo',
            url: '${pageContext.request.contextPath}/sysLog/list',
            cols: [[
                {field: 'userName',width:100, title: '访问人',align: 'center'},
                {field: 'visitTime',width:200, title: '访问时间 (默认按时间降序)',align: 'center'},
                {field: 'ip',width:150, title: 'IP地址',align: 'center'},
                {field: 'executionTime',width:150, title: '操作时间',align: 'center',templet:function (b) {return b.executionTime + 'ms';}},
                {field: 'url',title: '访问url',align: 'left'},
                {field: 'className',width:280,title: '访问类',align: 'left'},
                {field: 'method',width:180,title: '访问方法',align: 'left'},
            ]],
            page: true,
        });
        //监听查询条件按钮
        form.on("submit(data-search-btn)",function (data) {
            tableIns.reload({
                where:data.field,
                page:{
                    curr:1
                }
            });
            return false;
        });
    });
</script>
</body>
</html>
